package com.flashextended.apps.logomaker.view.core
{
	import com.flashextended.apps.logomaker.controlers.Controlers;
	import com.flashextended.apps.logomaker.view.core.background.CoreBackground;
	import com.flashextended.apps.logomaker.view.core.workarea.Workarea;
	
	import flash.filters.DropShadowFilter;
	
	import mx.containers.Canvas;
	import mx.core.ScrollPolicy;
	import mx.events.ResizeEvent;

	public class Core extends Canvas
	{
		private var background:CoreBackground;
		private var workarea:Workarea;
		
		public function Core()
		{
			super();
			this.addEventListener(ResizeEvent.RESIZE, containerResize);
			settings();
			
			background = new CoreBackground();
			this.addChild(background);
			workarea = new Workarea();
			this.addChild(workarea);
			Controlers.getInstance().addMouseAction(background, Controlers.getInstance().unselectObjectsWorkarea);
			this.clipContent = true;
			this.verticalScrollPolicy = ScrollPolicy.OFF;
			this.horizontalScrollPolicy = ScrollPolicy.OFF;
		}
		
		private function settings():void
		{
			this.percentWidth = 100;
			
			//this.percentHeight = 80;
			this.percentHeight = 100;
			this.setStyle("backgroundColor", 0xFFFFFF);
			var dropShadow:DropShadowFilter = new DropShadowFilter();
			this.filters = [dropShadow];
		}
		
		private function containerResize(e:ResizeEvent):void
		{
			this.move(this.parent.width/2-this.width/2, 52);
			this.height = this.parent.height - 170;
		}
		
	}
}